import { ReduxState } from '@/redux';
import { useSelector } from 'react-redux';

const AreaArr = ['0001', '0002', '0004', '0008', '0010', '0020', '0040', '0080', '0100', '0200'];

export const useSwitchInfo = () => {
  const { switchName, switchPic } = useSelector((state: ReduxState) => state?.cloudState);

  const switchInfo = [
    {
      dpId: 'switch_1',
      name: switchName.switch_1,
      pic: switchPic.switch_1,
      timerDpName: 'countdown_1',
      group: 1,
      type: 'water',
      logCode: 'irrigation_log1',
      areaInTimer: '0001'
    },
    {
      dpId: 'switch_2',
      name: switchName.switch_2,
      pic: switchPic.switch_2,
      timerDpName: 'countdown_2',
      group: 1,
      type: 'drug',
      logCode: 'irrigation_log2',
      areaInTimer: '0002'

    },
    {
      dpId: 'switch_3',
      name: switchName.switch_3,
      pic: switchPic.switch_3,
      timerDpName: 'countdown_3',
      group: 2,
      type: 'water',
      logCode: 'irrigation_log3',
      areaInTimer: '0004'
    },
    {
      dpId: 'switch_4',
      name: switchName.switch_4,
      pic: switchPic.switch_4,
      timerDpName: 'countdown_4',
      group: 2,
      type: 'drug',
      logCode: 'irrigation_log4',
      areaInTimer: '0008'
    },
    {
      dpId: 'switch_5',
      name: switchName.switch_5,
      pic: switchPic.switch_5,
      timerDpName: 'countdown_5',
      group: 3,
      type: 'water',
      logCode: 'irrigation_log5',
      areaInTimer: '0010'
    },
    {
      dpId: 'switch_6',
      name: switchName.switch_6,
      pic: switchPic.switch_6,
      timerDpName: 'countdown_6',
      group: 3,
      type: 'drug',
      logCode: 'irrigation_log6',
      areaInTimer: '0020'
    },
    {
      dpId: 'usb_switch_1',
      name: switchName.usb_switch_1,
      pic: switchPic.usb_switch_1,
      timerDpName: 'usb_countdown_1',
      group: 4,
      type: 'water',
      logCode: 'irrigation_log7',
      areaInTimer: '0040'
    },
    {
      dpId: 'usb_switch_2',
      name: switchName.usb_switch_2,
      pic: switchPic.usb_switch_2,
      timerDpName: 'usb_countdown_2',
      group: 4,
      type: 'drug',
      logCode: 'irrigation_log8' ,
      areaInTimer: '0080'
    },
    {
      dpId: 'switch9',
      name: switchName.switch9,
      pic: switchPic.switch9,
      timerDpName: 'countdown_9',
      group: 5,
      type: 'water',
      logCode: 'irrigation_log9',
      areaInTimer: '0100'
    },
    {
      dpId: 'switch10',
      name: switchName.switch10,
      pic: switchPic.switch10,
      timerDpName: 'countdown_10',
      group: 5,
      type: 'drug',
      logCode: 'irrigation_log10',
      areaInTimer: '0200'
    },
  ];

  return switchInfo;
};
